import 'package:flutter/material.dart';

class CustomListTile extends StatelessWidget {
  const CustomListTile({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final List<Map<String, String>> dataList = [
      {
        "name": "container组件",
        "doc": "container组件的相关应用",
        "router": "/container"
      },
      {"name": "text组件", "doc": "显示文字的组件", "router": "/text"},
      {"name": "Item 3", "doc": "Document 3", "router": "/secondPage"},
      {"name": "Item 4", "doc": "Document 4", "router": "/secondPage"},
      {"name": "Item 5", "doc": "Document 5", "router": "/secondPage"},
    ];

    return ListView.builder(
      itemCount: dataList.length,
      itemBuilder: (context, index) {
        final item = dataList[index];
        return ListTile(
          title: Text(item["name"] ?? ""),
          subtitle: Text(item["doc"] ?? ""),
          onTap: () {
            Navigator.pushNamed(context, item["router"] ?? "/");
          },
        );
      },
    );
  }
}
